package com.example.mark.config;

import com.example.mark.mapper.ChatMapper;
import com.example.mark.util.WebSocketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

/**
 * 开启WebSocket支持
 */
@Configuration
public class WebSocketConfig {

    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }

    @Autowired
    public void setChatMapper(ChatMapper chatMapper) {
        WebSocketService.chatMapper = chatMapper;

    }


}
